# 为了支持异步调用
import asyncio
from open_ai_model import getOpenAiModel

model = getOpenAiModel()


# 异步调用
async def async_stream():
    events = []
    events_step = []
    async for event in model.astream_events(input="hello", version="v2"):
        events.append(event)
        events_step.append(event["event"])
    print(events)
    print("\n\n")
    print(events_step)


# 运行异步流处理
asyncio.run(async_stream())
